﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Wwtfly.BBS.BackControllers.Base;
using System.Web.Mvc;
using Wwtfly.BBS.Framework.Common;
using Wwtfly.BBS.BackModels.Models.News;
using Wwtfly.BBS.BackBLL.News;
using Wwtfly.BBS.BackModels.ViewModels.News;
using Wwtfly.Utility;

namespace Wwtfly.BBS.BackControllers.Fore.News
{
    /// <summary>
    /// 新闻控制器..
    /// </summary>
    public class NewsController : ForeBaseController
    {
        /// <summary>
        /// 分页大小 
        /// </summary>
        private static readonly int PageSize = 15;

        public ActionResult NewsListPart(string pageParams)
        {
            ViewData["Title"] = "新闻列表页";
            PageParams pp = !string.IsNullOrEmpty(pageParams) ? new PageParams(pageParams) :
                new PageParams() { PageIndex = 1, PageSize = PageSize };
            NewsShowsSearchModel search = new NewsShowsSearchModel();
            int typeId = Request.QueryString["typeId"].AsInt(0);
            if (typeId != 0)
            {
                search.TypeId = typeId;
            }
            NewsShowsViewModel viewModel = new NewsShowsViewModel()
            {
                PageParams = pp,
                NewsShowsPagedList = NewsBLL.GetNewsShowsPageList(pp,search)
            };
            return View(viewModel);
        }

        public ActionResult List(string pageParams)
        {
            return View();
        }
    }
}
